#!/usr/bin/env python

import time
import datetime

'''String resource

@author Julot <andy.julot@gmail.com>
@since Thursday, February 16, 2012. 05:02 PM'''

class _App(object):
    '''App string resource
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, February 16, 2012. 06:05 PM'''
    
    name = 'Sayo'
    version = '1.0.1.0'
    description = 'Abip BTS Monitoring Server'
    longDescription = 'Abip BTS Monitoring Server'
    trademarks = 'As I pray, unlimited syntax works'
    copyright = 'Copyright 2012 Julot'
    company = 'Seraphim'
    author = 'Julot'
    authorEmail = 'andy.julot@gmail.com'
    blessing = 'May you do good and not evil.\r\n' \
             + 'May you find forgiveness for yourself and forgive others.\r\n' \
             + 'May you share freely, never taking more than you give.'
    humanVersion = ''

    def __init__(self):
        self.histories = {'0.0.0.0': '2012-03-15', self.version: 'Date'}
        
        versions = self.version.split('.')
        stages = ('Alpha', 'Beta', 'Release Candidate', 'Public Release')
        if int(versions[2]) == 3:
            if int(versions[3]) == 0:
                version = '%s.%s' % (versions[0], versions[1])
            else:
                version = '%s.%s Revision %s' % (versions[0], versions[1],
                                                 versions[3])
        else:
            if int(versions[3]) == 0:
                version = '%s.%s %s' % (versions[0], versions[1],
                                        stages[int(versions[2])])
            else:
                version = '%s.%s %s %s' % (versions[0], versions[1],
                                           stages[int(versions[2])],
                                           versions[3])
        self.humanVersion = version
        
        d = self.histories[self.version]
        f = "%Y-%m-%d"
        try:
            self.releaseDate = datetime.datetime(*time.strptime(d, f)[0:5])
        except:
            self.releaseDate = datetime.datetime.now()
        
class _MenuItem(object):
    '''Menu Item string resource
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, February 16, 2012. 05:25 PM'''
    
    label = ''
    help = ''
    
    def __init__(self, label, help=''):
        self.label = label
        self.help = help
    
class _Menu(object):
    '''Menu string resource
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, February 16, 2012. 05:25 PM'''
    
    class _Main(object):
        '''Main string resource
    
        @author Julot <andy.julot@gmail.com>
        @since Friday, February 17, 2012. 07:55 PM'''
        
        file = _MenuItem('&File', 'File')
        help = _MenuItem('&Help', 'Help')
        posts = _MenuItem('&Posts', 'Posts')
        
    class _File(object):
        '''File string resource
    
        @author Julot <andy.julot@gmail.com>
        @since Friday, February 17, 2012. 07:56 PM'''
        
        preferences = _MenuItem('Preferences', 'Preferences')
        quit = _MenuItem('&Quit\tCtrl+Q', 'Close the application')
    
    class _Help(object):
        '''Help string resource
        
        @author Julot <andy.julot@gmail.com>
        @since Friday, February 17, 2012. 07:55 PM'''
        
        index = _MenuItem('&Index\tF1', 'Index')
        about = _MenuItem('&About', 'About application')
    
    class _Posts(object):
        '''Posts class
        
        @author Julot <andy.julot@gmail.com>
        @since Friday, February 17, 2012. 08:04 PM'''
        
        start = _MenuItem('Start', 'Start download posts')
        stop = _MenuItem('Stop', 'Stop download posts')
        add = _MenuItem('Add', 'Add Search')
        remove = _MenuItem('Remove', 'Remove Search')
        synchronize = _MenuItem('Synchronize', 'Synchronize status with file')
    
    main = _Main()
    help = _Help()
    file = _File()
    posts = _Posts()

app = _App()
menu = _Menu()

